﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MagicBag.CRM.Model;

namespace MagicBag.CRM.IDAL
{
    /// <summary>
    /// 部门数据访问接口
    /// </summary>
    public interface IDepartment
    {
        /// <summary>
        /// 新增部门
        /// </summary>
        /// <param name="dept"></param>
        /// <returns></returns>
        int Insert(Department dept);

        /// <summary>
        /// 删除部门
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        int Delete(int id);

        /// <summary>
        /// 修改部门
        /// </summary>
        /// <param name="dept"></param>
        /// <returns></returns>
        int Update(Department dept);

        /// <summary>
        /// 根据部门ID获取部门信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Department GetDepartment(int id);

        /// <summary>
        /// 获取所有部门
        /// </summary>
        /// <returns></returns>
        IList<Department> GetDepartments();

        /// <summary>
        /// 分页获取部门信息
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        IList<Department> GetDepartments(int pageIndex, int pageSize,out int total);

        /// <summary>
        ///  获取当前部门的第一级子部门
        /// </summary>
        /// <param name="deptment"></param>
        /// <returns></returns>
        IList<Department> GetChildrens(Department deptment);

        /// <summary>
        /// 获取所有第N级部门
        /// </summary>
        /// <param name="level">部门级别，从0开始</param>
        /// <returns></returns>
        IList<Department> GetDepartmentsByLevel(int level);
    }
}
